<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>维修进度</title>
    <meta name="viewport" content="width=device-width"/>
    <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
    <link rel="stylesheet" href="https://cdn.bootcss.com/weui/1.1.3/style/weui.min.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.1/css/jquery-weui.min.css">
    <script src="js/ajax.js"></script>
</head>
<body>



<div id="app" >
    <div v-if="bxd">
        {{bxd}}
        {{str}}
        <!--//维修进度：维修工程师正在赶来，已经到达，正在维修，更换配件...，维修完成-->
    </div>
</div>

<!-- body 最后 -->
<script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-weui/1.2.1/js/jquery-weui.min.js"></script>

<!-- 如果使用了某些拓展插件还需要额外的JS -->
<script src="https://cdn.bootcss.com/jquery-weui/1.2.1/js/swiper.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-weui/1.2.1/js/city-picker.min.js"></script>
<script src="js/getopenid.js"></script>
<script>

    getopenid(function(openid){

        $.showLoading("正在加载...");
        $.get("/find_baoxiuman_byopenid", {openid: openid}, function (data) {
            $.hideLoading();
            if (!data) {
                $.toast("您还未绑定，请您先绑定！","cancel",function(){
                    location = 'baoxiuman_add.html';
                })
            }else{
                app.style.display= "";
            }
        });
    });

    var v = new Vue({
        el: "#app",
        data: {
            bxd:null,
            str:"正在维修中..."
        }
    });

    var url = document.URL;
    var index = url.indexOf("bxdid=")
    var  bxdid = url.substring(index+6);

    $.get("/find_bxd?id="+bxdid,null,function(data){
        v.bxd=data;
    })

    //向谁通知
    var ws = new WebSocket("ws://47.110.59.63/websocket/"+localStorage.openid);

    ws.onopen = function()
    {
        // Web Socket 已连接上，使用 send() 方法发送数据
        ws.send("发送数据");
        //alert("数据发送中...");
    };

    ws.onmessage = function (evt)
    {
        var received_msg = evt.data;
        v.str = received_msg;

        $.toast(received_msg,function(){
            location = "comment.html";
        })
        //跳转到修理进度页面
    };
</script>



</body>
</html>